<?php
namespace Admin\Model;
use Think\Model;

class ShopModel extends Model{
  protected $tableName = 'goodshop';
  protected $_auto = array(
    array('ctime','time',1,'function'),
    array('endtime','myfun',1,'callback'),
    );
  protected $_validate = array(
    array('name','require','标题不能空！'),
    array('case','require','分类不能空！'),
    array('des','require','描述不能空！'),
    array('content','require','详情页不能空！'),
  	);
  protected function myfun($time){
    return strtotime($time);
  }
  public function info($id, $field = true){
        /* 获取分类信息 */
        $map = array();
        if(is_numeric($id)){ //通过ID查询
            $map['id'] = $id;
        } else { //通过标识查询
            $map['name'] = $id;
        }
        return $this->field($field)->where($map)->find();
    }

}

 


?>